<!DOCTYPE html>
<html class="ui-page-login">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="../css/mui.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/login.css" />
		<style>
			.area {
				margin: 20px auto 0px auto;
			}
			
			.mui-input-group:first-child {
				margin-top: 20px;
			}
			
			.mui-input-group label {
				width: 22%;
			}
			
			.mui-input-row label~input,
			.mui-input-row label~select,
			.mui-input-row label~textarea {
				width: 78%;
			}
			
			.mui-checkbox input[type=checkbox],
			.mui-radio input[type=radio] {
				top: 6px;
			}
			
			.mui-content-padded {
				margin-top: 25px;
			}
			
			.mui-btn {
				padding: 10px;
			}
			
			.mui-input-row label~input,
			.mui-input-row label~select,
			.mui-input-row label~textarea {
				margin-top: 1px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">忘记密码</h1>
		</header>
		<div class="mui-content">
			<div class="mcc-img">
				<img src="../images/logo.png" />
			</div>

			<form class="mui-input-group">
				<div class="mui-input-row">
					<label><span class="mui-icon mui-icon-phone"></span></label>
					<input id='phone' type="text" class="mui-input-clear mui-input" placeholder="请输入手机号">
				</div>
				<div class="mui-input-row">
					<label><span class="mui-icon mui-icon-email"></span></label>
					<div class="mir-right">
						<input id='code' type="password" class="mui-input-clear mui-input mr-code" placeholder="请输入验证码">
						<button type="button" class="mui-btn mui-btn-primary mr-send" data-type="code">发送验证码 <span id="countdown" class="mui-badge mui-badge-primary">60</span></button>

					</div>
				</div>
				<div class="mui-input-row">
					<label><span class="mui-icon mui-icon-locked"></span></label>
					<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请输入密码">
				</div>
				<div class="mui-input-row">
					<label><span class="mui-icon mui-icon-compose"></span></label>
					<input id='password_confirm' type="password" class="mui-input-clear mui-input" placeholder="请确认密码">
				</div>
			</form>
			<div class="mui-content-padded">
				<button id='reg' class="mui-btn mui-btn-block mui-btn-primary">完成</button>
			</div>
		</div>
		<script src="../js/mui.js"></script>
		<script src="../js/app.js"></script>
		<script>
			(function($, doc) {
				$.init();

				mui(document.body).on('tap', '.mui-btn', function(e) {
					mui(this).button('loading');
					setTimeout(function() {
						mui(this).button('reset');
						var type = this.dataset.type;
						if(type === 'code') {
							var countdown = document.getElementById('countdown');
							var cdNum = countdown.innerText;
							var interval = setInterval(function() {
								cdNum -= 1;
								countdown.innerText = cdNum;
								if(cdNum === 0) {
									clearInterval(interval);
								}
							}, 1000);
						}
					}.bind(this), 2000);
				});

				$.plusReady(function() {
					var sendButton = doc.getElementById('sendMail');
					var emailBox = doc.getElementById('email');
					sendButton.addEventListener('tap', function() {
						app.forgetPassword(emailBox.value, function(err, info) {
							plus.nativeUI.toast(err || info);
						});
					}, false);
				});
			}(mui, document));
		</script>
	</body>

</html>